import 'package:ichinesereader/exam/dto/assessment_question_details.dart';

class QuestionRecordSection {
  QuestionRecordSection({
    this.introduction,
    this.partType,
    this.questions,
    this.subCategory,
    this.level,
    this.commitTime,
    this.kind,
    this.id,
    this.text,
    this.type,
    this.category,
    this.sample,
  });

  String? introduction;
  String? partType;
  List<QuestionDetails>? questions;
  String? subCategory;
  int? level;
  int? commitTime;
  String? kind;
  String? id;
  String? text;
  String? type;
  String? category;
  String? sample;

  factory QuestionRecordSection.fromJson(Map<String, dynamic> json) =>
      QuestionRecordSection(
        introduction: json["introduction"],
        partType: json["partType"],
        questions: json["questions"] != null
            ? List<QuestionDetails>.from(
                json["questions"].map((x) => QuestionDetails.fromJson(x)))
            : null,
        subCategory: json["subCategory"],
        level: json["level"],
        commitTime: json["commitTime"],
        kind: json["kind"],
        id: json["id"],
        text: json["text"],
        type: json["type"],
        category: json["category"],
        sample: json["sample"],
      );

  Map<String, dynamic> toJson() => {
        "questions": List<dynamic>.from(questions!.map((x) => x.toJson())),
      };
}
